package org.calzz.rpc.envelope;

import org.calzz.jajb.JsonDeserializer;
import org.calzz.jajb.JsonSerializer;
import org.calzz.jajb.converter.IConverter;
import org.calzz.jajb.io.IWriter;
import org.springframework.core.MethodParameter;

/**
 * @author Marek Brodziak <marek.brodziak@gmail.com>
 * @author Piotr Pejas <piotr.pejas@gmail.com>
 * @since Mar 6, 2008
 */
public class DummyConverter implements IConverter {

	/*
	 * (non-Javadoc)
	 * @see org.calzz.jajb.converter.IConverter#canConvert(java.lang.Class)
	 */
	public boolean canConvert(Class<?> clazz) {
		return true;
	}

	/*
	 * (non-Javadoc)
	 * @see org.calzz.jajb.converter.IConverter#marshal(java.lang.Object,
	 *      java.lang.String, org.calzz.jajb.io.IWriter,
	 *      org.calzz.jajb.JsonSerializer)
	 */
	public void marshal(Object obj, String name, IWriter writer, JsonSerializer serializer) {
		//empty
		serializer.process(obj, name, writer);
	}

	/*
	 * (non-Javadoc)
	 * @see org.calzz.jajb.converter.IConverter#unmarshal(java.lang.Object,
	 *      java.lang.Class, org.calzz.jajb.JsonDeserializer)
	 */
	public <T> Object unmarshal(Object env, Class<T> clazz, JsonDeserializer deserializer, MethodParameter methodParam) {
		return env;
	}

}
